<div class="comathangs form">
<?php echo $this->Form->create('Comathang');?>
	<fieldset>
		<legend><?php __('Thêm Có Mặt Hàng'); ?></legend>
	<?php
		echo $this->Form->input('mauvpp_id',array('label'=>'Mẩu Văn Phòng Phẩm',));
        //echo $this->Form->input('mathang_id',array('label'=>'M?t hàng'));
        echo '<table>
                <tr>
                    <td><b>STT</b></td>
                    <td><b>Mặt hàng</b></td>
                    <td><b>Số lượng</b></td>
                    <td><b>Đơn Giá</b></td>
                </tr>
        ';
        $stt = 0;
        //debug($ten);
        foreach($mathangs as $ma=>$mathang){
             
            echo '<tr><td>';
             //debug($ten[$mathang]);
            
            #Bat dau So thu tu
            $stt++; 
            echo $stt;
            #ket thuc So thu tu

            echo '</td><td>';
            #Bat dau Mat hang
            echo $this->Form->input(
                'mathang',
                array(
                    'type'=>'text',
                    'name'=>'data[Comathang][mathang][]',
                    'value'=>$mathang,
                    'style'=>'border: none; background: none',
                    'readonly'=>'readonly',
                    'label'=>$ten[$ma],
                )
            );
            #Ket thuc mat hang


            echo '</td><td>';
            #Bat dau so luong
            echo $this->Form->input(
                'soluong',
                array(
                    'name'=>'data[Comathang][soluong]['.$mathang.']',                    
                    'label'=>false,
                    'value'=>0,
                )
            ); 
            #Ket thuc so luong
            
            echo '</td><td>';
            #batdau don gia
           echo $this->Form->input(
                'dongia',
                array(
                    'type'=>'text',
                    'name'=>'data[Comathang][gia][]',
                    'value'=>$gias[$ma],
                    'style'=>'border: none; background: none',
                    'readonly'=>'readonly',
                    'label'=>false,
                )
            );
            #ket thuc don gia
           
        }
         
        echo '</table>';
		
	?>
	</fieldset>
<?php echo $this->Form->end(__('Luu', true));?>
</div>
